<template>
  <div class="userInfo">
    <nav-bar></nav-bar>
    <img src="../assets/timg.jpg" alt="">
    <user-Detail :userInfo="model"></user-Detail>
  </div>
</template>

<script>
  import NavBar from '../components/common/Navbar'
  import UserDetail from '../components/usercom/userDetail'
  export default {
    data(){
      return  {
        model:{}
      }
    },
    components:{
      NavBar,
      UserDetail
    },
    methods:{
      async userDate(){
        if(!window.sessionStorage.getItem('token')){
          this.$router.push('/login')
        }
        const res =  await this.$http.get('/user/' + window.sessionStorage.getItem('id'))
        this.model = res.data[0]
      },
    },
    created(){
      this.userDate()
    }
  }
</script>

<style lang="less" scoped>
  .userInfo{
    img{
      height: 170px;
      width: 100%;
    }
  }

</style>
